package com.lin.controller;

import com.google.gson.Gson;
import com.lin.common.rest.ResMsg;
import com.lin.common.utils.HttpClientUtils;
import com.lin.controller.req.ListSystemNotifyReqMsg;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.UnsupportedEncodingException;

@Api(tags = "系统消息通知")
@RestController
@RequestMapping("/msvc")
public class SystemNotifyController {
    @Value("${cs.system-notify}")
    private String url;

    @PostMapping("/listnotify")
    public ResMsg<Object> listSystemNotify(ListSystemNotifyReqMsg reqMsg) throws UnsupportedEncodingException {
        String result = HttpClientUtils.httpPost(url, reqMsg);
        Gson g = new Gson();
        return g.fromJson(result, ResMsg.class);
    }
}
